# -*- coding: utf-8 -*-
import re
from common import get_from_yd
from common import sql_script


def get_ket():
    p = re.compile(r'(^.+?)\s+(\S+)$')
    f = open("ket.txt")
    ket = {}
    for line in f:
        m = p.search(line)
        if m:
            ket[m.groups()[0]] = m.groups()[1]
        else:
            print "######"
            print line
    return ket


def main():
    ket = get_ket()
    #for i in ket:
    #    get_from_yd.get_audio(i, "/Users/stack/python/python3721/ket")
    sql_script.insert_list(ket.items(), "112.126.90.160", 54, "剑桥KET", 4598)

if __name__ == '__main__':
    main()
